package com.catsic.core.tree.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.catsic.base.tree.TreeInfo;
import com.catsic.core.autharea.service.AuthAreaService;
import com.catsic.core.conditon.OrganCondition;
import com.catsic.core.depart.service.DepartService;
import com.catsic.core.menu.service.MenuService;
import com.catsic.core.organ.service.OrganService;
import com.catsic.core.resource.service.ResourceService;
import com.catsic.core.tree.service.TreeService;
import com.catsic.pub.drawer.service.DrawerService;

@Service("treeService")
public class TreeServiceImpl implements TreeService{
	@Autowired
	private OrganService organService;
	
	@Autowired
	private DepartService departService;
	
	@Autowired
	private MenuService menuService;
	
	@Autowired
	private ResourceService resourceService;
	
	@Autowired
	private DrawerService drawerService;
	
	@Autowired
	private AuthAreaService authAreaService;
	
	public List<TreeInfo> organ(String id){
		return organService.getTreeInfo(id);
	}
	
	public List<TreeInfo> organ(OrganCondition condition){
		return organService.query(condition);
	}
	
	public List<TreeInfo> menu(String id){
		return menuService.getTreeInfo(id);
	}
	
	public List<TreeInfo> resource(String id){
		List<TreeInfo> list = menuService.getTreeInfo(id);
		list.addAll(resourceService.getTreeInfo(id));
		return list;
	}
	
	public List<TreeInfo> drawer(){
		return drawerService.getTreeInfo();
	}
	
	public List<TreeInfo> authArea(String resourceCode){
		List<TreeInfo> list = authAreaService.getTreeInfo(resourceCode);
		return list;
	}
}
